<div class="customContainer">
	<div class="row">
		<div id="manage-sub-nav">
			<ng-include src="'modules/manage/manage-left-sub-nav.html'"></ng-include>
		</div>
		<div class="manage-margin_left_sub_nav_width" id="manage-body-content">
			<div class="manage-toggle-sidebar-div">
				<a class="btn btn-primary btn-md manage-toggle-sidebar"><span
					class="glyphicon glyphicon-chevron-left"
					id="manage-close-open-icon"></span></a>
			</div>
			<div class="manage-body-content-body">
				<div class=" panel panel-default">
					<div class="panel-heading"
						style="padding-bottom:0;padding-left: 30px;height: 50px;">
						<h3 class="panel-title font_kaiti_20">
							标签管理<span style="font-size: 12px">(共{{tags.length}}条记录)</span>
						</h3>
					</div>
					<div class="panel-body " style="min-height: 440px">
						<div class="table-responsive tableTrBottomBorder">
							<table class="table table-hover">
								<thead>
									<tr class="border_bottom">
										<td>#</td>
										<td>名称</td>
										<td>文章</td>
										<td>操作</td>
									</tr>
								</thead>
								<tbody>
									<tr ng-repeat="tag in tags">
										<td>{{$index+1}}</td>
										<td>{{tag.name}}</td>
										<td>{{tag.counts}} <a class="btn btn-xs btn-info"
											ng-if="tag.counts!=0" style="margin: 0;"  ng-click="editArticle(tag)"
											title="点击查看">查看</a></td>
										<td><a class="btn btn-xs btn-warning"
											style="margin-right:10px" ng-click="editTag(tag)">编辑</a> <a
											class="btn btn-xs btn-danger" ng-click="deleteTag(tag)">删除</a>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
					</div>
					<script type="text/ng-template" id="editTag.html">
						<div class="modal-header">
							<h4 class="modal-title">修改</h4>
						</div>
						<div class="modal-body">
                            <div class="input-group">
                                <span class="input-group-addon">名称</span>
                                <input type="text" class="form-control" ng-model="tag.name"/>
                            </div>
						</div>
						<div class="modal-footer">
							<button type="button" class="btn btn-default" ng-click="cancelEditTag()"
								>取消</button>
							<button type="button" ng-click="confirmEditTag(tag)"
								 class="btn btn-warning">确认</button>
						</div>
					</script>
					<script type="text/ng-template" id="editTagArticle.html">
						<div class="modal-header">
							<h4 class="modal-title">标签：{{tag.name}}</h4>
						</div>
						<div class="modal-body">
							<div class="table-responsive tableTrBottomBorder">
							<table class="table table-hover">
								<thead>
									<tr class="border_bottom">
										<td>#</td>
										<td>标题</td>
										<td>状态</td>
										<td class="visible-lg">撰写时间</td>
										<td>操作</td>
									</tr>
								</thead>
								<tbody>
									<tr ng-repeat="article in tagArticles">
										<td>{{$index+1}}</td>
										<td>{{article.title}}</td>
										<td><span ng-if="article.status==1">博客</span><span
											ng-if="article.status==0">草稿</span></td>
										<td class="visible-lg">{{article.writeTime | date
											:'yyyy-MM-dd HH:ss'}}</td>
										<td>
											<ul class="list-unstyled">
												<li><a  class="btn btn-xs btn-info" style="margin-right:10px;margin-left: 0" ng-click="goArticle(article.id)">查看</a><a  class="btn btn-xs btn-danger"
													ng-click="goDeleteArticle(article)">删除</a></li> 
											</ul>
										</td>
									</tr>
								</tbody>
							</table>
						</div>		
						<div class="modal-footer">
							<button type="button" class="btn btn-default" ng-click="cancelEditArticle()"
								>关闭</button>
						</div>
					</script>
					<script type="text/ng-template" id="deleteTagArticle.html">
						<div class="modal-header">
							<h4 class="modal-title">警告</h4>
						</div>
						<div class="modal-body">
							确认从标签<span style="font-size:16px;font-weight:bolder;"> {{deleteArticleTag.name}} </span>中<br/>
							删除文章<span style="font-size:16px;font-weight:bolder;"> {{deleteArticle.title}} </span> 吗？
						</div>		
						<div class="modal-footer">
							<button type="button" class="btn btn-default" ng-click="cancelDeleteTagArticle()"
								>取消</button>
							<button type="button" ng-click="confirmDeleteTagArticle(deleteArticle.id)"
								 class="btn btn-danger">确认</button>
						</div>
					</script>
					<script type="text/ng-template" id="deleteTag.html">
						<div class="modal-header">
							<h4 class="modal-title" >警告</h4>
						</div>
						<div class="modal-body">
							确认删除标签<span style="font-size:16px;font-weight:bolder;"> {{tag.name}} </span>吗？
						</div>		
						<div class="modal-footer">
							<button type="button" class="btn btn-default" ng-click="cancelDeleteTag()"
								>取消</button>
							<button type="button" ng-click="confirmDeleteTag(tag.id)"
								 class="btn btn-danger">确认</button>
						</div>
					</script>
				</div>
			</div>
		</div>
	</div>
</div>
<script>
	$(function() {
		$(".manage-toggle-sidebar").click(
				function() {
					$("#manage-sub-nav").toggleClass("collapsed");
					$("#manage-body-content").toggleClass(
							"col-sm-12  manage-margin_left_sub_nav_width");
					$("#manage-close-open-icon").toggleClass(
							"glyphicon-chevron-right");
					return false;
				});
	});
</script>